package org.jeecg.modules.wlhy.hycustomeragent.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.wlhy.hycustomeragent.entity.HyCustomerAgent;
import org.jeecg.modules.wlhy.hycustomeragent.mapper.HyCustomerAgentMapper;
import org.jeecg.modules.wlhy.hycustomeragent.service.IHyCustomerAgentService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: hy_customer_agent
 * @Author: jeecg-boot
 * @Date:   2021-11-08
 * @Version: V1.0
 */
@Service
public class HyCustomerAgentServiceImpl extends ServiceImpl<HyCustomerAgentMapper, HyCustomerAgent> implements IHyCustomerAgentService {

    @Override
    public List<HyCustomerAgent> getListByCustomerId(String customerId) {
        return this.list(new QueryWrapper<HyCustomerAgent>().eq("customer_id", customerId));
    }

    @Override
    public HyCustomerAgent getByCustomerAndAgentId(String customerId, String agentId) {
        return this.getOne(new QueryWrapper<HyCustomerAgent>()
                .eq("customer_id" , customerId)
                .eq("agent_id",agentId));
    }

    @Override
    public List<HyCustomerAgent> getListByAgentId(String customerId) {
        return this.list(new QueryWrapper<HyCustomerAgent>().eq("agent_id", customerId));
    }
}
